package 算法.贪心算法;
//https://leetcode-cn.com/problems/is-subsequence/
public class 判断子序列 {
    public static void main(String[] args) {
        System.out.println(isSubsequence("aaaaa","bbaaaa"));
    }
    public static boolean isSubsequence(String s, String t) {
        int i = s.length();int j = t.length();
        int n = 0; int m = 0;
        while (n < i && m < j){
            if(s.charAt(n) == t.charAt(m)){
                n++;m++;
            }else {
                m++;
            }
        }
        if(n == i){
            return true;
        }
        return false;
    }
}
